<%--
  Created by IntelliJ IDEA.
  User: ZZDZZ
  Date: 2024/6/19
  Time: 16:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
<head>
    <title>图书列表</title>
    <style>
        table, th, td {
            border: 1px solid black;
            border-collapse: collapse;
        }
        th, td {
            padding: 5px;
            text-align: left;
        }
    </style>
</head>
<body>
<!-- 如果booksList为空，则显示没有借书提示文本 -->
<c:if test="${empty booksList}">
    <h1 align="center">没有借书</h1>
</c:if>

<!-- 如果booksList不为空，则显示借书信息 -->
<c:if test="${!empty booksList}">
    <h1 align="center">图书列表</h1>
    <table align="center">
        <tr>
            <th>图书ID</th>
            <th>标题</th>
            <th>作者</th>
        </tr>
        <c:forEach items="${booksList}" var="book">
            <tr>
                <td>${book.bookId}</td>
                <td>${book.title}</td>
                <td>${book.author}</td>
                <td>
                    <a href="returnBook?bookId=${book.bookId}">还书</a>
                </td>
            </tr>
        </c:forEach>
        <tr>
            <th>借书时间</th>
            <th>还书死线</th>
        </tr>
        <c:forEach items="${borrowRecordsList}" var="record">
            <tr>
                <td>${record.borrowDate}</td>
                <td>${record.dueDate}</td>
            </tr>
        </c:forEach>
    </table>
</c:if>
</body>
</html>
